<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>绑定html的属性</title>
    <script src="https://cdn.jsdelivr.net/npm/vue"></script>
    <style>
        .checked {
            background: #444;
            color: #eee;
        }
    </style>
</head>
<body>
<div id="app">
    <input type="checkbox" v-model="checked" id="r1">
    <label for="r1">修改颜色</label>

    <div v-bind:class="{'checked': checked}">
        绑定了样式。选中变色
    </div>
</div>

<script>
    new Vue({
        el: '#app',
        data: {
            checked: false
        }
    });
</script>
</body>
</body>
</html>